﻿
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

using Microsoft.Extensions.Logging.Abstractions;

namespace EvaluationSystem.Models
{
    [Table("student_course")]
    public class StudentEvalCourse
    {
        public int ScId { get; set; }

        public string? Evals { get; set; }

        public float? Score { get; set; }

        public DateTime CreatedAt { get; set; } = DateTime.Now;


        public int TeacherCourserId { get; set; }

        [NotMapped]
        public TeacherWithCourse? TeacherWithCourses { get; set; }


        public int StudentId { get; set; }

        [NotMapped]
        public People? Student { get; set; }

        public StudentEvalCourse()
        {
        }

        public StudentEvalCourse(StudentEvalCourse studentEvalCourse)
        {
            ScId = studentEvalCourse.ScId;
            TeacherCourserId = studentEvalCourse.TeacherCourserId;
            StudentId = studentEvalCourse.StudentId;
            Evals = studentEvalCourse.Evals;
            CreatedAt = studentEvalCourse.CreatedAt;
        }

        public StudentEvalCourse(StudentEvalCourse studentEvalCourse, People student) : this(studentEvalCourse)
        {
            Student = student;
        }

        public StudentEvalCourse(StudentEvalCourse studentEvalCourse, TeacherWithCourse? teacherWithCourse, People? student) : this(studentEvalCourse)
        {
            if (student != null)
                Student = student;
            if (teacherWithCourse != null)
                TeacherWithCourses = teacherWithCourse;
        }
    }
}
